import lombok.Data;

@Data
public class Book {
    private String id;         // 书籍ID
    private String title;      // 书名
    private String author;     // 作者
    private int stock;         // 库存（>=0）
    private BookStatus status; // 状态枚举

    public void borrow() {
        if (this.status != BookStatus.AVAILABLE) {
            throw new IllegalStateException("图书不可借");
        }
        this.stock--;
        this.status = BookStatus.BORROWED;
    }
}